package com.xuecheng.test.rabbitmq;

import com.alibaba.fastjson.JSON;
import com.xuecheng.test.rabbitmq.config.RabbitmqConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.HashMap;
import java.util.Map;

@SpringBootTest
@RunWith(SpringRunner.class)
public class Producer05_topics_springboot {
    @Autowired RabbitTemplate rabbitTemplate;
    @Test
    public void testSendEmail(){

        Map<String,String> map=new HashMap();
        map.put("getId","测试数据");
        Object json=JSON.toJSONString(map);
        rabbitTemplate.convertSendAndReceive(RabbitmqConfig.EXCHANGE_TOPICS_INFORM,"inform.email",json);
    }
}
